<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>{$head[title]}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="{$head[keywords]}" name="keywords" />
<meta content="{$head[description]}" name="description" />
<base href="{SITE_URL}" />
<link href="favicon.ico" rel="shortcut icon" />
<link href="skin/style.css" rel="stylesheet" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="{$head[title]}" href="/rss.php?rssid={$catid}" />
<script language="JavaScript" src="misc/config.js"></script>
<script language="JavaScript" src="misc/jquery.min.js"></script>
<script language="JavaScript" src="misc/common.js"></script>
<script language="JavaScript" src="misc/validator.js"></script>
</head>
<body>

{template 'header.html'}

<div class="container">
	
    <div class="aside">
    	{template 'left.html','order'}
    </div>
    <div class="main"> 
    
    
    	<p id="position"> <strong>当前位置：</strong><a href="">首页</a><a href="{$MODULE[member][url]}">会员中心</a><a href="{$M[url]}">订单</a>收货地址</p>
    
    <div class="head">管理收货地址</div>
        <table cellpadding="0" cellspacing="1" class="table_list"> 
          <tr>
            <th width="60">收货人</th>
            <th width="60">配送区域</th>
            <th width="90">电话</th>
            <th width="90">手机</th>
            <th>地址</th>
            <th width="50">邮编</th>
            <th width="80">操作</th>
          </tr>
    {if $delivers}
    {loop $delivers $k $d}
          <tr>
            <td>{$d[consignee]}</td>
            <td>{$AREA[$d[areaid]][name]}<input type="hidden" name="areaid_{$d[deliverid]}" id="areaid_{$d[deliverid]}" value="{$d[areaid]}"><input type="hidden" name="areaname_{$d[deliverid]}" id="areaname_{$d[deliverid]}" value="{$AREA[$d[areaid]][name]}"></td>
            <td>{$d[telephone]}</td>
            <td>{$d[mobile]}</td>
            <td class="align_l">{$d[address]}</td>
            <td>{$d[postcode]}</td>
            <td><a href="{$M[url]}deliver.php?action=edit&deliverid={$d[deliverid]}">修改</a> | <a href="javascript:confirmurl('{$M[url]}deliver.php?action=delete&deliverid={$d[deliverid]}', '删除该地区')">删除</a></td>
          </tr>
    {/loop}
    {/if}
       </table>
    
    {if !$delivers || count($delivers) < $M['maxdelivers']}
    
    <div class="head">新增收货地址</div>
    <form action="{$M[url]}deliver.php?action=add" method="post" name="myform" id ="myform">
    <table cellpadding="0" cellspacing="1" id="newdeliver" class="table"> 
          <tr>
            <th width="15%"><font color="red">*</font> 配送区域：</th>
            <td>
                <input type="hidden" name="d[areaid]" id="areaid" value="{$areaid}">
                <span id="load_areaid"></span>
                <a href="javascript:areaid_reload();">重选</a>
            </td> 
          </tr>
          <tr>
            <th><font color="red">*</font> 收货人：</th>
            <td><input type="text" name="d[consignee]" id="consignee" value="{$consignee}" size="12" require="true" datatype="require" msg="请填写收货人"/></td>       
          </tr>
          <tr>
            <th><font color="red">*</font> 电话：</th>
            <td><input type="text" name="d[telephone]" id="telephone" value="{$telephone}" size="20" require="true" datatype="custom" regexp="^[\d|\-|\+]{3,20}$"  msg="请填写正确的电话" msgid="telephone_notice"/> 格式：010-10000000-801 <span id="telephone_notice"></span></td>     
          </tr>
          <tr>
            <th><font color="red">*</font> 手机：</th>
            <td><input type="text" name="d[mobile]" id="mobile" value="{$mobile}" size="20" require="true" datatype="mobile" msg="请填写正确的手机" msgid="mobile_notice"/> 格式：13800000000 <span id="mobile_notice"></span></td>       
          </tr>
          <tr>
            <th><font color="red">*</font> 地址：</th>
            <td><input type="text" name="d[address]" id="address" value="{$address}" size="60" require="true" datatype="require" msg="填写正确的地址"/></td>       
          </tr>
          <tr>
            <th><font color="red">*</font> 邮编：</th>
            <td><input type="text" name="d[postcode]" id="postcode" value="{$postcode}" size="8" require="true" datatype="zip" msg="填写正确的邮编" msgid="postcode_notice"/> 格式：100000 <span id="postcode_notice"></span></td>       
          </tr>
          <tr>
            <th></th>
            <td><input type="submit" name="dosubmit" value=" 确定 "/> <input type="reset" name="reset" value=" 重置 "/> 最多保存{$M[maxdelivers]}个有效地址</td>       
          </tr>
    </table>
    </form>	
    {/if}
        
   </div>
</div>
    
    

{template 'footer.html'}
    
    
<script type="text/javascript" src="images/js/validator.js"></script>
<script language="javascript" type="text/javascript">
$().ready(function() {
	  $('form').checkForm(1);
});

function areaid_load(id)
{
	$.get("load.php", { field: 'areaid', id: id }, function(data){
		$('#load_areaid').append(data);
	});
}

function areaid_reload()
{
	$('#load_areaid').html('');
	areaid_load(0);
}
areaid_reload();
</script>